lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206).
authorStephen Berman <stephen.berman@gmx.net>
Wed, 13 Oct 2010 23:15:03 +0000 (01:15 +0200)
committerJuanma Barranquero <lekktu@gmail.com>
Wed, 13 Oct 2010 23:15:03 +0000 (01:15 +0200)
lisp/ChangeLog
lisp/subr.el

index cea50f8625ed937d02824f4dbe41223aa42030bd..bed00b43055c08d0f94e9550462821a29661ee82 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-13  Stephen Berman  <stephen.berman@gmx.net>
+
+       * subr.el (last): Use `safe-length' instead of `length' (bug#7206).
+
 2010-10-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * net/tls.el (tls-program): Remove spurious %s from openssl.
index 0ed4ae62795fa0d1bc841efe1eb736aca0d21467..dabadec770e62ae3268b5e8615ca606885c39fed 100644 (file)
@@ -290,10 +290,10 @@ If N is non-nil, return the Nth-to-last link of LIST.
 If N is bigger than the length of LIST, return LIST."
   (if n
       (and (> n 0)
-           (let ((m (length list)))
+           (let ((m (safe-length list)))
              (if (< n m) (nthcdr (- m n) list) list)))
     (and list
-         (nthcdr (1- (length list)) list))))
+         (nthcdr (1- (safe-length list)) list))))
 
 (defun butlast (list &optional n)
   "Return a copy of LIST with the last N elements removed."